﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GeoSwarm_Editor.Game
{
    public class Creep
    {

        private int typeID;
        private int count;

        public Creep(int type, int count)
        {
            this.typeID = type;
            this.count = count;
        }

        public int Count
        {
            get
            {
                return count;
            }
            set
            {
                count = value;
            }
        }

        public int Type
        {
            get
            {
                return typeID;
            }
            set
            {
                typeID = value;
            }
        }

        public override string ToString()
        {
            return UppercaseFirst(Creep.GetCreepTypeFromID(typeID).ToLower());
        }

        private string UppercaseFirst(string s)
        {
            if (string.IsNullOrEmpty(s))
            {
                return string.Empty;
            }
            char[] a = s.ToCharArray();
            a[0] = char.ToUpper(a[0]);
            return new string(a);
        }

        /*
         * Fetches the creep type from a creep ID
         */
        public static String GetCreepTypeFromID(int creepID)
        {
            switch (creepID)
            {
                case 0:
                    return "CHOMPER";
                case 1:
                    return "SPINNER";
                case 2:
                    return "WIGGLE";
                case 3:
                    return "STAR";
                case 4:
                    return "CUBIC";
                case 5:
                    return "PULSAR";
                case 6:
                    return "SWARM";
                default:
                    return "CHOMPER";
            }
        }

    }
}
